Copyright: Made with Shalom Help Maker www.danish-shareware.dk/soft/shelpm/


Contents

 SelfImage - Disk Imager for Windows v1.1

Welcome to the SelfImage help file.  The following topics are covered here:

 Introduction
 Using SelfImage
 Compression
 Preferences
 Disks & Partitions tutorial
 Change Log
 License


Introduction

 SelfImage - Disk Imager for Windows v1.1

SelfImage is a disk imaging program for Windows.  It allows you to create an image of any partition on your computer's hard drives.  It can even create images from partitions that Windows can't access and don't have drive letters assigned to.  Linux partitions, for example.  This makes it easy to make backups of a second operating system's partitions.  The following chart outlines SelfImage's capabilities (when run on Windows 2000 or later):

As illustrated above, SelfImage is not a full-fledged backup program.   While it can create an image from any partition on any hard drive connected to your computer, it cannot always restore that image back to the partition.  SelfImage cannot by itself write an image back to any partition that Windows is currently using.  If any program has any files open on the partition, an image cannot be restored to it.  This automatically precludes restoring an image to your boot (C:) drive.  Also, SelfImage currently does not support compressing a disk image while it is being made.  This means that the image file must be written to a disk that has enough free space to contain the entire partition you are imaging.

With those limitations in mind, SelfImage can be a useful tool to:
 Create a backup of a second operating system's partition. (Windows 2000 or later)
 Switch secondary operating systems or test out different versions while keeping the ability to go back to your old one. (Windows 2000 or later)
 Create images from and restore images to data partitions.
 Create a backup image of your Windows boot drive.  Assuming that image is stored in a place that is accessable if your computer is booted from a secondary operating system, it can then be restored back to the source drive.

<<< WARNING >>>        <<< WARNING >>>        <<< WARNING >>>

It is possible to destroy your hard drive's data with SelfImage - possibly beyond any chance of recovery.  This help file attempts to give you the information you need to safely use it, but you need to always remember that you are taking your computer's life in your own hands when you write data directly to a partition.  Make sure you have a clear understanding of how hard disks and partitions work.  In addition, you are advised to read the licensing terms under which this software is released - particularly sections 11 and 12 which disclaim all warranty and liability.

<<< WARNING >>>        <<< WARNING >>>        <<< WARNING >>>


Using SelfImage

When launched, SelfImage will take a moment to gather information about the hard drive partitions on your computer.  After this, the main window will be displayed.

SelfImage main window

SelfImage is simply a copy program with the ability to copy to and from files, hard drive partitions, and network block devices.  In general, operation of SelfImage consists simply of:

1) Select what type of input you want: file, drive (partition), or network block device (NBD)

2) Select the location of the input - ie: where the file is, what partition you want, or the address of the NBD server.

3) If the input is a compressed file, specify whether or not you want to decompress the output (by default, decompression is enabled any time a compressed file is selected as the input)

4) If the input isn't compressed already, then specify whether or not you want to compress the output.  Generally, if the input is a partition or NBD and you are making an image of it to a file, then you will probably want to compress the output.

5) Repeat steps 1 and 2 for the output - select the type of output and its location.

6) Once the above steps are performed, the Ok button should be enabled.  Click on it to start the operation.  The window will change to show you the progress and some information on processing speed.

Cancelling an operation
Once you click Ok and begin to make/restore an image, the main window will change to display progress information.  You can cancel the operation at any time by clicking the "Cancel" button.  The operation will terminate immediately, however it may take a couple seconds for SelfImage to shut down all its internal processing and switch the window's visual back to normal.

For information on how to perform specific operations, see the following help topics:
  Making a disk image
  Restoring a disk image back to a partition
  Direct partition-to-partition copying
  Direct file-to-file copying


Making a disk image

Making a disk image:
Select the "disk" radio button in the input section.  Once selected, the "Input Location" field will become a drop-down control.  When you click on the Input Location's " [image] " button, a list of all the floppy drives and hard disk partitions will drop down.  Select the one that you want to make an image of.  Once selected, the "Input Size" label will show you the size of this partition.

Next choose whether you want the image you make to be compressed.  See the compression help topic for more information on SelfImage's compression capabilities.

Lastly, select the "file" radio button in the output section.  As soon as you click on it, the Output Location field will become a filename box and a file selection dialog will appear.  Navigate to the directory you want to store the image file in, enter the filename, and click Ok.  Any time after selecting the file and before starting the copy operation, if you decide that you want to change the directory or filename of the target image file, click the Output Location's " [image] " button and the file selection dialog will return.

There can be a risk that your disk image will contain corrupted data whenever you make an image of partitions that are currently mounted (assigned a drive letter in Windows).  Please see the help file topic on this subject for more information.


Restoring a disk image

Restoring a disk image back to a partition:
Select the "file" radio button in the input section.  As soon as you click on it, the "Input Location" field will become a filename box and a file selection dialog will appear.  Navigate to the location of the disk image and select it.  Once selected, the "Input Size" label will show you the size of this file.  If the input image file is compressed, the processing option to decompress it will automatically be selected.  Any time after selecting the file and before starting the copy operation, if you decide that you want to use a different image,  click the Input Location's " [image] " button and the file selection dialog will return.

Next sthe "disk" radio button in the input section.  Once selected, the "Input Location" field will become a drop-down control.  When you click on the Input Location's " [image] " button , you will see a list of all the floppy drives and writable hard disk partitions on your computer (ones that were writable at the time that SelfImage was started).  To refresh this list, select "Refresh Drive Lists" from the Edit menu.  This will make SelfImage re-examine all the hard disk partitions to determine if they are writable.

Once you have selected a partition or floppy drive to write to, its size will be shown.  If the input size is different from the size of the partition, it means that the select image file did not originate from the partition you have selected to write it to.  While there may be some very few circumstances where you will want to do this, it hardly ever a good idea to try to restore an image to a partition it did not originate from.  Don't attempt this unless you know what you are doing.


Direct partition-to-partition copying
While direct copying of one partition to another is possible with SelfImage, do not attempt it unless you know what you are doing is correct.  You can easily corrupt all data on your hard drive.  It is generally only useful to do when you have installed a hard drive in your computer for the express purpose of "cloning" partitions from your existing hard drive.


Direct file-to-file copying
SelfImage is also capable of copying one image file to another.  Launching SelfImage just to copy a file is probably overkill in most cases.  However, when copying a large image file, especially when copying from one partition to another where both partitions are located on the same physical hard drive, SelfImage may be much faster than using Windows to copy it.  It might also be useful at times to use file-to-file copying in order to compress or decompress an image file.


Compression

SelfImage is capable of on-the-fly compression and decompression as it makes and restores disk images.

Accelerated Compression
SelfImage is capable of accelerating compression and decompression by using more than one processor.  If your computer has more than one CPU, has a dual or multi-core CPU, or has hyperthreading, then SelfImage will use separate compression "threads" to enable all of your system's CPUs to compress simultaneously.  SelfImage will automatically detect the number of processors in your system and adjust its compression/decompression accordingly.

Compression Settings
SelfImage has three compression settings.  In order of fastest/worst-compression to slowest/best-compression they are:

 gzip (fast): Uses the gzip compression engine in its fastest mode.  If SelfImage can use accelerated compression on your system, this setting is quite often as fast or faster than not using any compression at all.  By default, this setting is equivalent to compressing a file with the gzip program using the "-1" switch, although that can be tuned in the preferences dialog.  The resulting .gz file is fully compatible with the gzip program.
 gzip (best): Uses the gzip compression engine in its best mode.  Better compression than gzip (fast), but a little less than half the speed.  By default, this setting is equivalent to compressing a file using the gzip program with the "-9" switch, although that can be tuned in the preferences dialog.   The resulting .gz file is fully compatible with the gzip program.
 bzip2: Uses the bzip2 compression engine in its best mode.  The best compression of the three settings, but by far the slowest.  It is approximately 1/3 to 1/4 the speed of gzip (best).  This setting is equivalent to using the bzip2 program with the "-9" switch.  The resulting .bz2 file is fully compatible with both the bzip2 and pbzip2 (parallel bzip2) programs.

Decompression
Decompression is selected automatically whenever a compressed source file is selected.  It can be turned off simply by selecting the "None" radio button in the processing group box.  If decompression is turned off on a compressed input file, it will be copied directly to the output.

Compatibility
SelfImage uses a "block compression" method that isn't compatible with all file compression programs.  While the official gzip and bzip2 programs are capable of handling this sort of compression, not all third-party compressors that support gzip/bzip2 files will support files in this format.

Jeff Gilchrist's pbzip2 program is one that is fully compatible with SelfImage's bz2-compressed files.  It also supports accelerated parallel compression/decompression - it produces and uses bz2 files that are divided into blocks.  The bz2 files it produces can be decompressed in parallel by SelfImage and vice versa.

<<< WARNING >>>        <<< WARNING >>>        <<< WARNING >>>

SelfImage allows you to compress data that is going directly to a partition or NBD.  There are very few instances where this is something you would want to do.  Compressing data that you send directly to a partition or NBD will most likely result in making that partition unusable.  SelfImage will warn you if you ever attempt to send compressed data directly to a partition or NBD - if you see this warning, heed it.  Do not proceed unless you know you want to do this and the reasons for it.

<<< WARNING >>>        <<< WARNING >>>        <<< WARNING >>>


Preferences

SelfImage's preferences dialog is activated from within the main menu's Edit menu, and looks as shown below:

Preferences Dialog

To access the preferences for any of the below categories, click on the appropriate tab on the preferences dialog.

General Options
 Notify when new version is released: This setting causes SelfImage to check each time it is activated (maximum one check per day) to see if there is a new release available.  No information is sent during this check.  The check is performed by retrieving the text file at URL http://selfimage.excelcia.org/SelfImageCurrentVersion.txt checking its contents against SelfImage's internal version string.  When you are notified of an update, you will be given the option at that time of telling SelfImage not to notify you again until the next new release is detected.
 Save window positions: Causes SelfImage to remember the position and size of its window when it is closed and start there again the next time it is opened.  Turning off this option allows the operating system to decide where to place the window.
 Do not warn when writing to a partition: By default, SelfImage will issue a warning when you are writing directly to a partition.  This is to give you a chance to make sure all your settings are correct.  You can disable that warning by setting this option.  This will not disable other warnings that SelfImage issues when it detects potential problems with your settings.

Read Options
 Automatically skip a partition's free space: When this option is set, and when reading from a mounted NTFS or FAT32 partition, SelfImage will determine what parts of a partition are unused, free space.  It will then skip reading those portions and act as if it had read all zeros.  This setting takes on the most significance when compression is enabled as SelfImage can replace this unused data with precompressed blocks of zeros.  In this case, SelfImage doesn't have to actually read or calculate anything - and as the compression on these areas is at leat 1000:1, it doesn't have to write much of anything either.  Thus, when compression is enabled along with this setting, the processing of these areas of a partition is essentially instantaneous.  The size of the compressed image will also be much smaller.

Network Block Device (NBD) Options
 Timeout: Sets the length of time, in milliseconds, that SelfImage will wait for data from a Network Block Device server.  The default is five seconds (5000 milliseconds).  Increase this if you encounter timeout errors while connecting to NBD servers over the Internet.  The minumum for this setting is 100 milliseconds, and the maximum is 99999.
  Transaction Size: Sets the maximum amount of data that will be read from or written to a Network Block Device server in a single transaction.  In general, because SelfImage is interested in reading or writing the whole device, the larger the transaction size is, the more efficient (and thus faster) SelfImage will be.  By default, a Network Block Device server supports a maximum transaction size of one megabyte (1024 kilobytes).  Unless the NBD serve you are connecting to has been compiled to support larger transactions, setting SelfImage any larger than this will only cause an error when you attempt to read or write.  If you are connecting to a server over the Internet, it may be beneficial to reduce the transaction size.  The minimum for this setting is 64 kilobytes, and the maximum is 2048.

Compression
 # of Processing Threads: SelfImage is capable of accelerating compression by using more than one [image] thread.  This setting controls how many threads SelfImage uses when compressing or decompressing.  For best performance, there should be one thread for each CPU or virtual CPU in your computer.  A computer with two hyperthreaded CPUs could get extra performance from up to four threads.  Having more threads than you need will decrease performance.  Leaving this at zero (recommended) will cause SelfImage to auto-detect how many threads to start.  You can tell how many threads SelfImage would start under autodection by looking at the number in square brackets.  In the above picture, that would be two.
 gzip (fast) compression level: You can tune the compression level setting that SelfImage uses when you select the gzip (fast) compression method.  There are nine compression levels with gzip.  By default, "gzip (fast)" will use setting one, which is fastest but offers the lowest compression ratio.  If you wish better compression when using "gzip (fast)" at the expense of slower processing, you can turn this up.
 gzip (best) compression level:  By default, "gzip (best)" will use set gzip's compression level (see above) to nine, which offers the gzip's best compression ratio but is slowest.  If you wish better processing speed when using "gzip (best)" at the expense of lower compression, you can turn this down.


Connect To NBD Server

When NBD is selected as a source or destination, a "Connect to NBD Server" dialog will appear, as shown below:

 Host: The host name or IP address of the machine that is running the Network Block Device server.
 Port: The NBD protocol doesn't have a preset port number - the port number is set when each individual NBD server is started.  This allows you to have more than one NBD server running on the same machine at the same time.  Fill in the port number in this box for the server you are connecting to.  This must be a number between 1 and 65535 inclusive.
 Alias: If you have one or more servers you connect to regularly, you can assign a name to the connection and save it for reuse.  Enter the name you want to save the connection information as in the Alias field, and click the " [image] " button.  To delete an existing alias, select the alias from the dropdown control and click the " [image] " button.  Selecting an alias from the dropdown control will fill in the host and port numbers that were saved with it.


Disks & Partitions

A hard drive is divided up into one or more usable areas called partitions.  These partitions are then formatted for use by Windows or perhaps other operating systems and used to store files on.  This formatting is generally called a "filesystem".  Different types of filesystems that current versions of Windows use include FAT, FAT32, and NTFS.The following example shows how a hard drive's space might be divided up:

 At the beginning is what is called the "Master Boot Record" - the initial boot code for your computer which includes the partition table for the hard drive.  There will always be a master boot record and partition table, even if there is only one partition, and even if the hard disk is a secondary one that doesn't boot.  The partition table tells the operating system where each partition is on the drive and what filesystem is being used on that partition.  Following the table are one or more partitions.  Under Windows 95/95/ME, SelfImage refers to each partition by its Windows drive letter: C:, D:, etc.  In Windows 2000 or later, SelfImage refers to each disk and partition by using a device name in the form: \Device\HarddiskH\PartitionP where H is the number of the hard disk and P is the number of the partition.  The hard disk number starts with zero, while the partition number starts with one, so the first partition on the first hard drive in your system would be \Device\Harddisk0\Partition1.  If a partition is mounted (assigned a drive letter), SelfImage will display the drive letter beside the device name.  For most people, the C: drive is the first partition of the first hard disk, so SelfImage would display it as: "\Device\Harddisk0\Partition1 (C:)".

The reason that hard disk are numbered starting with zero and partitions are numbered starting with one is that partition number zero is a special name that refers to the hard disk in its entirety.  Because this isn't an actual "partition", SelfImage omits the text 'Partition0' when it displays this and refers to it as: "\Device\Harddisk0 (entire disk)".  It is important to remember that, even if you only have one partition on your hard drive, taking an image of that partition is different from taking an image of the entire disk.  When you take an image of the partition, the image does not include the MBR or partition table.  It includes only the filesystem on that partition.  If you were to take an image of the entire disk and restore it back to a partition, you would corrupt that partition and it would not be accessible.  Windows would look at the beginning of the partition for that partition's filesystem and it would not find it because there is a copy of the hard disk's partition table there.  If you were to do the opposite - take an image of a partition and restore it to the entire disk, you would corrupt the entire disk drive - it would no longer be bootable.  You would overwrite the hard disk's master boot record with the filesystem of the partition you took the image from.  There may be times when you want to take an image of an entire disk, but it's important that when you do that you restore it back to the entire disk.

It is also important to remember that if you have two different partitions that contain different filesystems, that you cannot swap them with SelfImage (at least, not just with SelfImage) - even if the partitions are exactly the same size.  This is because the information that tells the operating system what filesystem is being used in a partition is not stored inside the partition, but is stored in the partition table.  In order to swap the contents of two partitions and have the operating system recognize the swap, you would need to also edit the partition table to change the partition types for each partition.

Partition Naming in Linux
SelfImage does not write any extra data to the images it creates.  This means that you can use other operating systems to restore the images.  This is useful for cases where you want to make an image of a partition that cannot be written to in Windows.  You can make an image of the partition in Windows and, if needed, restore the image back to the partition using another operating system like Linux.  In order to do this, you must understand how Linux disk and partition names correspond to Windows names.

In Linux, IDE hard disks are named starting with "/dev/hda" for the first, and incrementing by one letter for each subsequent one ("/dev/hdb", "/dev/hdc", etc).  In Linux, this naming includes anything on the IDE bus, including optical (CD/DVD) drives.  It can also skip letters in some circumstances.  The primary disk on the first IDE channel is always "/dev/hda", the secondary disk on the first IDE channel is always "/dev/hdb".  Likewise the primary and secondary drives on the second IDE channel are "/dev/hdc" and "/dev/hdd".  There doesn't have to be a "/dev/hdb" for there to be a "/dev/hdc".

Once you know the name of the disk, you get partitions within that disk by adding numbers to the end.  The device "/dev/hda1" refers to the first partition.  On most computers, the windows device "\Device\Harddisk0\Partition1" and the Linux device "/dev/hda1" refer to the same partition - the first partition on the primary hard drive connected to the first IDE channel.  There are times when the partition numbers between Linux and Windows won't match.  Windows will always skip extended partitions in its numbering, while Linux doesn't.  It's vital to make sure that if you are using Linux to resture an image made with SelfImage that you ensure you aren't restoring it to the wrong partition.  Also make sure that if you take an image of an entire disk with SelfImage in Windows, that you restore it to the device that represents the entire disk in Linux.  Thus, if you take an image of "\Device\Harddisk0 (entire disk)" in Windows, you would restore it to "/dev/hda" in Linux, and not "/dev/hda1".

With Linux, you don't need any special software to restore a disk image created by SelfImage back to the hard disk.  All you need to do is "cat" the file and send the output to the appropriate device.  For example:  "cat partition1.img > /dev/hda1" would write the image stored in the file partition1.img to the device /dev/hda1.

Mounting a Disk Image in Linux
The fact that SelfImage adds nothing to image files also means you can also use Linux to mount a disk image as if it were an actual hard disk partition.  This is done using "loopback" mode.  For example: "mount -o loop partition1.img /mnt/test" would mount the disk image stored in the file partition1.img and link it to the directory /mnt/test.


How to Improve Your Compression Ratios

Disk images are a great way of backing up a hard disk, but they can be extremely large.  Whether or not they can be used effectively often depends on our ability to make them smaller.

Compression Method
The first, and most obvious, way to improve your compression ratio and make smaller images is to use the best compression engine possible.  SelfImage supports gzip and bzip2.  While much slower, bzip2 generally gives the best compression ratios.

Empty Space
The second way to improve your compression ratios is to make your disks more compressable to begin with.  Most hard drives have at least some free space on them.  That free space, however, takes up space on a disk image.  You can make your disk images much more "compressable" by optimizing the free space on your disks.

When run on Windows 2000, XP, or later, SelfImage has the ability to skip over areas of a Windows partition that are unused and to replace them with blank data in the resulting image.  However, if your disk is highly fragmented, there might not be enough blank space in a row for SelfImage to skip.  You can gather your empty space together by defragmenting your hard disk partitions.  Every recent version of Windows has an included disk defragmenter.  For most versions, if you right click on a drive letter in Windows Explorer, and select "tools", you will have the option of defragmenting.  You don't have to defragment every time you want to make a disk image.  If you defragment often, though, then your disks will generally be in good shape for imaging.

If you have turned off the option for having SelfImage skip unused portions of a disk, or if you are running on an earlier version of Windows, you can still improve your compression ratio by making sure the free space on your disks is really and truly blank.  When you create and then delete a file, the deleted file is not truly deleted.  The space it took on the disk is simply marked as being able to be used again.  Thus, the "empty" space on your hard drive isn't necesarily a bunch of zeros.  Most of the time, it's a mishmash of leftoever bits.  In the short term, defragmenting your hard drive can actually decrease your compression ratio in SelfImage, since defragmenting also leaves behind the traces of all the files it moves.  The second step, then, is to use a program that blanks your hard disk's free space.  One such program is called "Eraser" (see http://sourceforge.net/projects/eraser).  This is an open source program that, among other things, can ensure that all the empty space on your hard disks is actually blank - zeroed out.  It is also capable of scheduling operations to wipe your free space.  Like defragmenting, this isn't something that needs to be done every time you make a disk image - but if it is done regularly, it will significantly improve how compressable your disks are.  Eraser is capable of scheduling operations to wipe free space, so you might want to consider having your computer automatically clean out its unused space at night when no one is using it.

Cleaning Linux Partitions
SelfImage cannot automatically skip over the unused portions of Linux partitions.  If you have a dual-boot system and use SelfImage to create images of Linux partition, you can clean out the free space in those partitions too.  In general, Linux filesystems don't need defragmenting.  They are very resistant to file fragmentation in the first place.  You can erase your unused space, though, by simply creating a file with all zeros that takes up all your free space and then deleting it.  Use the "df" command to find out how much free space is on your filesystem (it will be reported as the number of free 1k blocks), then use the following command:
  $ dd if=/dev/zero of=ZEROFILE bs=1024 count=#FREEBLOCKS
Do the above, replacing #FREEBLOCKS with the actual number of free blocks that "df" reported.  You may get an error about running out of disk space, but when it is done, this will have create a file called ZEROFILE that takes up all your free space.  After deleting that file, all your free space will have been zeroed out.  The next time you boot into Windows, that partition should compress much better in SelfImage.

You might not want to do the above if you are logged in as the superuser (root).  Most linux systems reserve a small amount of disk space for use by superuser so that important processes don't run into trouble if you run out of disk space.  If you are logged in as root, subtract a few thousand from #FREEBLOCKS before you do it.


Risks of Imaging a Live Partition

It is possible when taking an image of a live partition - a partition that is currently mounted and assigned a drive letter - that you could end up with an image that has corrupted data.  If you are careful, then the risk is very small, but it is something you should be concious of.

When making a disk image, you are copying everything on the disk, but you are not doing it instantaneously.  It takes time to read everything on the source partition and write it to the image.  The risk when doing this to a live partition is that something on the partition might change while this is occuring.  To limit this possibility, you should always close down as many other programs as possible before making an image.  Once SelfImage has begun its work, don't start any programs or open or copy any files.  Be concious of the programs that are running in the background.  Download programs that are minimized to your task tray, for example.  It might not seem like it, but even the act of browsing the web can impact your disk image, as web browsers cache a lot of data on disk.

This doesn't mean that you can't trust disk images made of live partitions.  Unless you try and use a defragmenting utility at the same time you are making a disk image, it is extremely unlikely that a disk image will be corrupted.  It is still a very good idea to always peform an error check of a partition after having restored it from an image.  This is a good idea regardless of whether the image was taken from a live partition or not.


Writable Partition

For a partition to be writable, it cannot contain any files that are being used by any programs that are currently running (or being used by the Windows operating system itself).  This is why the boot partition (the partition you boot your computer into Windows from and which contains the \windows or \winnt directory) can never be written to by SelfImage.


Windows Versions

SelfImage runs a little differently depending on the version of Windows you are running it on.

Under the older Windows versions (Windows 95, Windows 98, and Windows ME), SelfImage is not able to access partitions that Windows doesn't know about.  If the partition is invisible to Windows, then it is also invisible to SelfImage.  In addition, SelfImage can access only partitions and not the full hard drive.

Under newer NT-based versions of Windows (Windows 2000, Windows XP, Windows Vista), SelfImage is able to access all partitions, regardless of whether they contain a filesystem that Windows recognizes or not.  SelfImage is also capable of reading either a specific partition on a hard drive, or the entire hard drive.


Mounted

If a partition is recognized by Windows as being of a type it can access the files on, and if Windows has assigned a drive letter to it, then that partition is said to be "mounted".  If a partition is one that Windows cannot access the files on (ie: a Linux partition), or if it is one that it recognizes but you have told Windows not to assign it a drive letter, then that partition is unmounted.  Windows 95/98/ME will automatically mount any partition they recognize.  With Windows 2000 or later, you can control if a partition is mounted through the Disk Management console.


Extended Partitions

The partition table on PC hard disks can only hold four entries allowing for only up to four partitions per hard disk.

An extended partition is a way to subdivide one of the four standard (or "primary") partitions to allow you to have more than four partitions per drive.  The operating system or partition editor creates a primary partition and then, at the beginning of that partition, writes another partition table which allows it to be divided up into smaller "sub" partitions.

The naming can be confusing - sometimes the primary partition that is created as space to hold the "sub" partitions is itself called an "extended partition".  Sometimes the sub-partitions that are created inside it are called "extended partitions".

In Windows, the primary partition that is used to provide the space isn't numbered - you can't access it with a \Device\Harddisk#\Partition# device name.  In Linux, these partitions are numbered with the rest of the partitions in the /dev/hda# devices.  Because of this difference, it's possible for the partition numbers in Linux and Windows to become mismatched.


Block Compression

In order to use more than one CPU at a time to accelerate compression, SelfImage divides up the input file/partition into blocks.  These blocks are compressed separately and each one becomes its own little gzip or bzip2 file in and of itself.  The resulting blocks are then assembled in the correct order and written to the output as your compressed file.

This is like taking two files and compressing each of them with either gzip or bzip2, then concatenating the resulting compressed files together one right after the other into a third file.  If you used gzip or bzip2 to decompress this concatenation of two compressed files, the result you would get is the concatenation of the two original uncompressed files.

The benefit of compressing a partition in individual blocks and then concatenating those blocks together is the ability to compress with more than one CPU at a time.  On today's hyperthreading, dual/multi-core and multi-cpu systems, this can be an increase anywhere from 10% to 400% in compression speed.  The drawback is a slight space penalty, generally less than 0.1%, when compared to non-block-compression.


NBD

The [image] Network Block Device (NBD) protocol is a method of sharing drive space over a network.  Unlike [image] Windows Networking (SMB/CIFS) or [image] NFS, the drive space is not shared on an individual file basis, but as if it were a disk partition.  Linux is capable of mounting these remote NBD partitions as if they were local ones.  SelfImage uses NBD as a way to make an image of a partition on a remote computer.

NBD servers exist for the Linux operating system.  Right now the Windows NBD server is badly out of date and doesn't support the current NBD protocol.  A new server is currently under development to offer remote imaging of Windows systems.


Change Log

SelfImage version 1.1.1 build 56 (27 Dec 2005)
 Bugfix: gzip stream decompression (decompression of gzip files not compressed in blocks) would give a bzip2 error.
 Bugfix: gzip & bzip2 stream decompression would only work once, then give an error.  Well, gzip stream decompression wouldn't work at all (see above), but it would break differently after the first time it was attempted.

SelfImage version 1.1.0 build 55 (9 Dec 2005)
 Added highly optimized memory copy routines.  This is mostly useful for when decompressing parallel (block) compressed bzip2 files, as on average 32k per block has to be copied to the next block.  This probably won't do more than shave a few hundredths of a percent off of the total processing time, but it's the purist in me.
 Added the ability for SelfImage to skip over unused portions of a mounted NTFS or FAT32 partition.  These portions are zeroed when written to the output file.  If compression is enabled, precompressed blocks are written, so no processing time is used compressing empty space.  This makes skipping over unused portions of a partition essentially instantaneous when compression is enabled.  When not compressing, SelfImage still has to write out all the zeros, but since it doesn't have to read anything, this will speed up operations where the source and destination are on the same physical drive.
 Added Network Block Device support.  SelfImage can now read from and write to a remote partition shared with an NBD server.
 Cleaned up the main window.  The input and output settings are now radio buttons organized horizontally and whichever one is selected changes what edit controls are visible.
 Changed the preferences dialog to use tabs.  Nicer look and feel, less clutter.
 Bugfix: Fixed a longstanding problem where if you a) clicked on the "file" radio button, b) clicked cancel in the file requester, c) then clicked on another window or clicked help, that the file requester would display repeatedly and not allow anything else to be selected.  Turns out that radio buttons try and select themselves if they have the focus - can't uncheck them and leave them with the focus or else you run into problems.

SelfImage version 1.0.1 build 48 (2 Dec 2005)
 Bugfix: The "Processing" preferences are now saved properly.  A bug in the TConfiguration class prevented them from saving to the registry in 1.0.0.
 Bugfix: Fixed what was acting like a memory leak when using gzip compression/decompression.  It wasn't actually a memory leak, but a bug in C++ Builder's memory management.  It claims to be thread safe, but is provably not.  SelfImage now uses the FastMM memory management library, which is faster, and rock solid.  Special thanks goes to Pierre le Riche, the author of FastMM, who very kindly changed the licensing terms of the library at my request.  It had been MPL before (which was incompatible with SelfImage's GPL license), and he is now releasing it as MPL/LGPL.  Thank-you!  The about box has been changed to add a reference to FastMM.
 Bugfix: Cleaned up a whole lot of actual memory leaks that I discovered while looking for the big one during gzip compression.  None of them were serious - most were simple little bits of memory that weren't released before the program exited.  Everything the program uses is now released gracefully.
 Made the compression and decompression loops a little more efficient by eliminating some memory allocations/deallocations that were being done on a block-by-block basis.  Those loops now use the stack and static storage.
 SelfImage should now react faster when a copy operation is cancelled.  The TImageBuffer maximum wait time was reduced from 1 second to 1/10th of a second and all threads are now actively cancelled, rather than just the read and write threads.

SelfImage version 1.0.0 build 44 (30 Nov 2005)
 Added: Compression and decompression support.  SelfImage can now compress/decompress images on the fly.  Both gzip and bzip2 compression are supported.  SelfImage can use more than one CPU at a time to compress/decompress in parallel.  It does this by dividing up the image into blocks and compressing each block separately.  This will reduce the compression ratio with gzip a very little (approx 0.1%), but on SMP/dual-core systems will almost double processing speed.  On hyperthreading systems, the performance boost is more modest - about 10%.  SelfImage will autodetect the number of threads it should start.  If you suspect that SelfImage is starting too many or not enough, you can see how many SelfImage thinks it should start and tweak that number in the preferences.
 Added: During a copy operation, SelfImage now displays its percentage completion in the program's title so you can tell if it's finished by looking on the taskbar.
 Bugfix: Major memory leak plugged.  It appeart that I simply forgot to write a destructor for one class.
 Bugfix: A file necesary to create the installer (SelfImageAutoUpdates.ini) was missing from the source distribution.  It was never added to my version control system, so it never made it into source distros.  This is now fixed.
 Bugfix: Adding compression exposed a bug in the TImageBuffer class.  In versions < 1.0 it would cause SelfImage to fail if more than one instance was running at the same time.
 Bugfix: The help button for the preferences dialog wasn't actually connected to the help file.  This has been corrected.
 Bugfix: The fix for the EOF problem (0.2 Beta 2) was flawed.  SelfImage would no longer crash when the input file was a direct multiple of one megabyte, but the resulting image file would be exactly one megabyte too large.  The bug has now been fixed well and truly this time.
 Changed the about box to add the ability to have multiple text pages.  Added a credits page to acknowledge the third party libraries used by SelfImage (zlib, libbzip2, and JVCL).
 Removed all the JVCL components from SelfImage!  That's a huge monkey off my back.  JVCL is a library of C++ Builder components that is released under an open source license.  Unfortunately, the license they use (Mozilla Public License) isn't compatible with the GPL.  It was a blunder on my part to use those components without being more careful about the licensing considerations.  It's a huge relief to finally get rid of them for reasons that I won't go into here.  Besides, they were HUGE bloat.  SelfImage's executable went from being 2.8MB to 1.1MB when they were removed!

Self Image version 0.2.0 build 23 (20 Nov 2005)
 No changes from 0.2.0 BETA 2 except relabeling for release.

Self Image version 0.2.0 BETA 2 build 22 (18 Nov 2005)
 No major functional changes between the last beta and this one.  A couple bug fixes and changes aimed at making the project more professional.
 Bugfix: The "Ok" button was enabled at times when it shouldn't have been.
 Bugfix: If an input file or partition's size was an exact multiple of one megabyte, then the EOF (end of file) was mistaken for an error.  This meant the write thread would be terminated early, before it could finish writing out all the buffers.  Thanks to Jeff Gilchrist (of pbzip2 fame) for catching the problem.
 Added the main menu, mostly to allow quick access to different help topics.
 Added this help file.
 Added version checking to notify the user when new releases are available.
 Added a preferences dialog.  Can disable version checking, write warnings, and window position saving.
 Added support for saving the window position and size between runs.
 Added a series of warnings to alert the user when performing potentially dangerous operations.  A warning whenever writing directly to a partition that can be disabled.  Other warnings, like when copying an image file to a partition where the image file is a different size than the destination partition, can't be disabled.
 Added a cool about box.  This actually isn't vanity - well, not just vanity.  It's relatively important to put the legal info (including the disclaimer of all warranty and liability) somewhere easily accessible.  This is a program that tinkers around with people's hard disk partitions - that disclaimer of warranty and liability is important to me. Having a spot to stick that little slogan was just icing on the cake. :)

Self Image version 0.2.0 BETA 1 build 9 (9 Nov 2005)
 Complete rewrite of pretty much everything.  As future versions are to support compression and possibly encryption, the copy engine was made multi-threaded with an intelligent buffering system capable of being implemented in chains.  This makes it possible to add any number of intermediary threads in between the read and write thread.
 Now capable of writing an image to a partition, instead of just creating the images.  The stage has been set so that any input Self Image is capable of reading from can go to any output that Self Image is capable of writing to.  This means that Self Image could be used to copy one file to another (which might actually be useful for very large files as Self Image is way more efficient than Windows at copying), or one partition to another.

Self Image version 0.1.0 build 2 (7 Aug 2005)
 Initial public release.  One big, terrible, ugly hack.  Can only create imaged - no restoring of images back to a disk.


License

This software is released under the terms of version 2 of the GNU General Public License:

GNU GENERAL PUBLIC LICENSE
Version 2, June 1991

 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

Preamble
The licenses for most software are designed to take away your freedom to share and change it.  By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.  This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it.  (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.)  You can apply it to your programs, too.

When we speak of free software, we are referring to freedom, not price.  Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have.  You must make sure that they, too, receive or can get the source code.  And you must show them these terms so they know their rights.

We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software.  If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original authors' reputations.

Finally, any free program is threatened constantly by software patents.  We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary.  To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

The precise terms and conditions for copying, distribution and modification follow.

GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License.  The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in the term "modification".)  Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not covered by this License; they are outside its scope.  The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.

1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

    a) You must cause the modified files to carry prominent notices
    stating that you changed the files and the date of any change.

    b) You must cause any work that you distribute or publish, that in
    whole or in part contains or is derived from the Program or any
    part thereof, to be licensed as a whole at no charge to all third
    parties under the terms of this License.

    c) If the modified program normally reads commands interactively
    when run, you must cause it, when started running for such
    interactive use in the most ordinary way, to print or display an
    announcement including an appropriate copyright notice and a
    notice that there is no warranty (or else, saying that you provide
    a warranty) and that users may redistribute the program under
    these conditions, and telling the user how to view a copy of this
    License.  (Exception: if the Program itself is interactive but
    does not normally print such an announcement, your work based on
    the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole.  If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works.  But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under the scope of this License.

3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:

    a) Accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of Sections
    1 and 2 above on a medium customarily used for software interchange; or,

    b) Accompany it with a written offer, valid for at least three
    years, to give any third party, for a charge no more than your
    cost of physically performing source distribution, a complete
    machine-readable copy of the corresponding source code, to be
    distributed under the terms of Sections 1 and 2 above on a medium
    customarily used for software interchange; or,

    c) Accompany it with the information you received as to the offer
    to distribute corresponding source code.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form with such
    an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for making modifications to it.  For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable.  However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.

4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License.  Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

5. You are not required to accept this License, since you have not signed it.  However, nothing else grants you permission to modify or distribute the Program or its derivative works.  These actions are prohibited by law if you do not accept this License.  Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.

6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions.  You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License.  If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all.  For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.

It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates the limitation as if written in the body of this License.

9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time.  Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number.  If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation.  If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.

10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission.  For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this.  Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

NO WARRANTY

11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

END OF TERMS AND CONDITIONS